package com.zc.app;

import javafx.application.Application;
import javafx.application.Platform;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.layout.VBox;
import javafx.scene.text.Text;
import javafx.stage.Stage;

/**
 *  JavaFX test 1
 * Created by CZC70 on 2017/5/11.
 */
public class HelloFXApp extends Application{

    public static void main(String[] args){
        launch(args);
    }

    @Override
    public void start(Stage primaryStage) throws Exception {
        primaryStage.setTitle("Hello JavaFX Application");
        primaryStage.setMaxHeight(200);
        primaryStage.setMaxWidth(300);

        VBox root = new VBox();
        Text msg = new Text("Hello JavaFX");
        root.getChildren().add(msg);

        Button exitBtn = new Button("Exit");
        exitBtn.setOnAction(e -> Platform.exit());
        root.getChildren().add(exitBtn);

        Scene scene = new Scene(root, 300, 50);
        primaryStage.setScene(scene);

        primaryStage.show();
    }
}
